#include <iostream>
#include <cmath>

using namespace std;

int N = 0, M = 0, K = 0;
char A[501010], B[501010];
int initial_vertical_line[501010] = { 0 };
int* horizontal_line = new int[501010];
//int lower_horizontal_line[501010] = { 0 };

void initial_all_line(void);
int create_bp_map(void);

int main()
{
	cin >> N >> M >> K;
	if (abs(N - M) > K)
	{
		cout << -1 << endl;
	}
	else
	{
		cin >> A;
		cin >> B;

		initial_all_line();
		int num = create_bp_map();

		if (num > K)
		{
			cout << -1 << endl;
		}
		else
		{
			cout << num << endl;
		}
	}
	return 0;
}

void initial_all_line(void)
{
	for (int i = 0; i < N; i++)
	{
		horizontal_line[i] = i;
	}
	for (int i = 0; i < M; i++)
	{
		initial_vertical_line[i] = i;
	}
}

int create_bp_map(void)
{
	for (int i = 1; i < M; i++)//i是行标
	{
		int* next_horizontal_line = new int[501010];
		next_horizontal_line[0] = initial_vertical_line[i];
		int min_in_line = initial_vertical_line[i];
		for (int j = 1; j < N; j++)//j是列标
		{
			if (A[j - 1] == B[i - 1])
			{
				next_horizontal_line[j] = horizontal_line[j - 1];
			}
			else
			{
				next_horizontal_line[j] = min(next_horizontal_line[j - 1], horizontal_line[j]) + 1;
			}
			if (next_horizontal_line[j] < min_in_line)
			{
				min_in_line = next_horizontal_line[j];
			}
		}
		for (int a = 0; a < N; a++)
		{
			cout << next_horizontal_line[a] << " ";
		}
		cout << endl;
		if (min_in_line > K)
		{
			return K + 10;
		}
		else
		{
			int* tmp = horizontal_line;
			horizontal_line = next_horizontal_line;
			next_horizontal_line = tmp;
			delete[] tmp;
		}
	}
	return horizontal_line[N - 1];
}